import request from '@/utils/request'

/**
* @description:获取-角色列表
* @param {object} params 页码和条数
*/
export const getRoleList = params => {
  return request.get('/sys/role', { params })
}

/**
* @description:查询企业
* @param {string} companyId 企业id
*/
export const getCompanyInfo = companyId => {
  return request.get(`/company/${companyId}`)
}

/**
* @description: 删除角色
* @param {string} id 被删除的角色id
*/
export const deleteRole = id => {
  return request.delete(`/sys/role/${id}`)
}

/**
* @description: 修改角色详情
* @param {Object}
*/
export const updateRole = data => {
  return request.put(`/sys/role/${data.id}`, data)
}

/**
* @description: 获取-角色详情
* @param {string} id 角色详情id
*/
export const getRoleDetail = id => {
  return request.get(`/sys/role/${id}`)
}

/**
* @description: 新增-角色
* @param {object}
*/
export const addRole = data => {
  return request.post('/sys/role', data)
}

/**
* @description: 给角色分配权限
* @param {Object} data
*/
export const assignPerm = data => {
  return request.put('/sys/role/assignPrem', data)
}
